
//
//  ShareSuccessView.swift
//  SmartHousekeeper
//
//  Created by 张磊 on 2020/2/23.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit
//分享成功
class ShareSuccessView: UIView {
    
    let backGroudImg = UIImageView()
    
    
    lazy var imgLogo : UIImageView = {
        let value = UIImageView(image: UIImage(named: "icon_yqkr"))
        return value
    }()
    
    lazy var communityL : UILabel = {
        let value = UILabel(textColor: RGBColor(r: 40, g: 40, b: 40, a: 1), textFont: UIFont.boldSystemFont(ofSize: Adapter(20)))
        value.text = "邀请客人进入小区预约登记"
        return value
    }()
    
    lazy var imgSuccessLogo : UIImageView = {
        let value = UIImageView(image: UIImage(named: "icon_success"))
        return value
    }()
    
    lazy var paySuccessL: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 40, g: 40, b: 40, a: 1), textFont: UIFont.systemFont(ofSize: Adapter(26)))
        value.text = "二维码分享成功"
        return value
    }()
    
    lazy var timeinL: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 116, g: 116, b: 116, a: 1), textFont: UIFont.boldSystemFont(ofSize: Adapter(20)))
        value.text = "唐先生将于2020年2月17日19:30"
        return value
    }()
    
    lazy var inL: UILabel = {
        let value = UILabel(textColor: RGBColor(r: 116, g: 116, b: 116, a: 1), textFont: UIFont.boldSystemFont(ofSize: Adapter(20)))
        value.text = "进入您的小区家里做客"
        return value
    }()
    
    lazy var paymentBtn : UIButton = {
        let value = UIButton(textColor: .white, textFont: UIFont.boldSystemFont(ofSize: Adapter(20)))
        value.setTitle("完成", for: .normal)
        value.layer.cornerRadius = Adapter(7)
        value.layer.masksToBounds = true
        value.backgroundColor =  RGBColor(r: 62, g: 134, b: 230, a: 1)
        return value
    }()
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUi()
    }
    private func setUi(){
        
        backGroudImg.image = UIImage(named: "mianBack")
        self .addSubview(backGroudImg)
        backGroudImg.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
        
        let top : CGFloat = UIDevice.isX() ? 88 : 64
        
        self.addSubview(communityL)
        communityL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview().offset(Adapter(15))
            make.top.equalToSuperview().offset(top)
            make.height.equalTo(Adapter(20))
        }
        
        self.addSubview(imgLogo)
        imgLogo.snp.makeConstraints { (make) in
            make.right.equalTo(communityL.snp.left).offset(-Adapter(10))
            make.centerY.equalTo(communityL)
            make.size.equalTo(CGSize(width: Adapter(20), height: Adapter(20)))
        }
                
        let line = UIView()
        line.backgroundColor = RGBColor(r: 114, g: 114, b: 114, a: 1)
        self.addSubview(line)
        line.snp.makeConstraints { (make) in
            make.left.equalTo(self).offset(Adapter(15))
            make.right.equalTo(self).offset(-Adapter(15))
            make.top.equalTo(communityL.snp.bottom).offset(Adapter(44))
            make.height.equalTo(Adapter(0.8))
        }
        
        self.addSubview(paySuccessL)
        paySuccessL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.centerY.equalToSuperview().offset(-80)
            make.height.equalTo( Adapter(20));
        }
        
        self.addSubview(imgSuccessLogo)
        imgSuccessLogo.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(paySuccessL.snp.top).offset(-Adapter(30))
            make.size.equalTo(CGSize(width: Adapter(60), height: Adapter(60)))
        }
        
        self.addSubview(timeinL)
        timeinL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(paySuccessL.snp.bottom).offset(Adapter(30))
            make.height.equalTo(Adapter(35));
        }
        
        self.addSubview(inL)
        inL.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(timeinL.snp.bottom).offset(Adapter(5))
            make.height.equalTo(Adapter(27));
        }
        
        let company = UILabel()
        company.textColor = RGBColor(r: 116, g: 116, b: 116, a: 1)
        company.font = UIFont.systemFont(ofSize: Adapter(12))
        company.text = "技术提供商:上海领美软件科技有限公司"
        self.addSubview(company)
        company.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview().offset(-Adapter(120))
            make.height.equalTo(Adapter(20))
        }
        
        self.addSubview(paymentBtn)
        paymentBtn.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(Adapter(30))
            make.right.equalToSuperview().offset(-Adapter(30))
            make.top.equalTo(company.snp.bottom).offset(Adapter(15))
            make.height.equalTo(Adapter(45))
        }
        
        
    }
    
}
